package com.example.rpc.consumer;

import com.example.rpc.api.HelloService;
import com.example.rpc.framework.Invocation;
import com.example.rpc.framework.ProxyFactory;
import com.example.rpc.framework.protocl.http.HttpClient;

public class Consumer {
    public static void main(String[] args) {
        proxyCall();
    }

    private static void commonCall(){
        HttpClient client=new HttpClient();
        Invocation invocation=new Invocation(HelloService.class.getName(),"sayHello",new Class[]{String.class},new Object[]{"lucy"});
        String result=client.send("localhost",8080,invocation);
        System.out.println(result);
    }

    private static void proxyCall(){
        HelloService helloService=ProxyFactory.getProxy(HelloService.class);
        System.out.println(helloService.sayHello("张安"));
    }
}
